package com.yunhoo.base.db.impl;

import com.yunhoo.base.model.AbroadGroupCurrency;
import com.yunhoo.base.model.MsgModel;
import com.yunhoo.sys.db.util.IbatisTemplate;
import com.yunhoo.sys.util.common.LoginParam;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 出国差旅费报销单
 *
 * @author Administrator
 */
public class AbroadGroupCurrencyImpl {

    private static String nameSpace = "currency.";

    public static List<AbroadGroupCurrency> getCurrencyList() {
        Map map = new HashMap();
        map.put("orgCode",LoginParam.getOrg().getCode());
        map.put("iyear", LoginParam.getIyear());
        return IbatisTemplate.queryForList(nameSpace + "getCurrencyList", map);
    }

    public static AbroadGroupCurrency getCurrencybyCode(String str) {
        Map map = new HashMap();
        map.put("orgCode",LoginParam.getOrg().getCode());
        map.put("iyear", LoginParam.getIyear());
        map.put("code",str);
        return (AbroadGroupCurrency) IbatisTemplate.query(nameSpace + "getCurrencybyCode", map);
    }

    public static List<AbroadGroupCurrency> checkCurrencyRepeat(AbroadGroupCurrency group) {
        return IbatisTemplate.queryForList(nameSpace + "checkCurrencyRepeat", group);
    }

    public static void insertCurrency(Map map) {
        map.put("orgCode",LoginParam.getOrg().getCode());
        map.put("iyear", LoginParam.getIyear());
        IbatisTemplate.insert(nameSpace + "insertCurrency", map);
    }

    public static void updateCurrency(Map map) {
        map.put("orgCode",LoginParam.getOrg().getCode());
        map.put("iyear", LoginParam.getIyear());
        IbatisTemplate.update(nameSpace + "updateCurrency", map);
    }

    public static void deleteCurrency(String str) {
        Map map = new HashMap();
        map.put("orgCode",LoginParam.getOrg().getCode());
        map.put("iyear", LoginParam.getIyear());
        map.put("code",str);
        IbatisTemplate.delete(nameSpace + "deleteCurrency", map);
    }
    
    public static MsgModel selectCurrencyMsg(String currencyCode){
        Map map = new HashMap();
        map.put("orgCode",LoginParam.getOrg().getCode());
        map.put("iyear", LoginParam.getIyear());
        map.put("code",currencyCode);
        return (MsgModel) IbatisTemplate.query(nameSpace + "selectCurrencyMsg", map);
    }
}
